package com.hackintosh.state.thread;

/**
 * @description：阻塞状态
 * @author：twislyn
 * @date：Created in 2021/05/23
 * @modified By：
 * @version: 1.0
 */
public class Blocked extends AbstractThreadState {
    public Blocked() {
        this.stateName = "BLOCK";
        System.out.println("当前线程处于：阻塞状态.");
    }

    public void resume(ThreadContext threadContext) {
        System.out.print("调用resume()方法-->");
        if (stateName.equals("BLOCK")) {
            threadContext.setState(new Runnable());
        } else {
            System.out.println("当前线程不是阻塞状态，不能调用resume()方法.");
        }
    }
}
